<html>
<head>

<title>Edit Profile</title>
</head>
<body>
<?php
session_start();
include 'connect.php';

$query = "SELECT * FROM members WHERE MemberID=".$_SESSION['MemberID'];
$result = mysql_query($query);

if (!$result) {
    $message  = 'Invalid query: ' . mysql_error() . "\n";
    $message .= 'Whole query: ' . $query;
    die($message);
}
$numResults = mysql_num_rows($result);
echo '<p>Number of Profiles found: '.$numResults.'</p>';

if (mysql_num_rows($result) == 0) {
    echo "No rows found, nothing to print so am exiting";
    exit;
}

// While a row of data exists, put that row in $row as an associative array
// Note: If you're expecting just one row, no need to use a loop
while ($row = mysql_fetch_assoc($result)) {
	echo "<a href='updateProfileForm.php?MemberID=".$row["MemberID"]."'>";
    echo '<b>'.$row["Name"]. "</b</a></br>";
    echo '<span class="details">'.$row["Email"]. "<br />";
    echo '<b>'.$row["Phone"]. "</b</a></br>";

}

mysql_free_result($result);

mysql_close($connection);
?>
</body>
</html>